package mipushdemo.xiaomi.com.diyitonghang.presenter.impl.loginimpl;

import android.util.Log;

import mipushdemo.xiaomi.com.diyitonghang.data.bean.LoginBean;
import mipushdemo.xiaomi.com.diyitonghang.model.imodel.loginmodel.IMaModel;
import mipushdemo.xiaomi.com.diyitonghang.model.impl.loginimpl.MaModelImpl;
import mipushdemo.xiaomi.com.diyitonghang.presenter.contract.homecontract.IMaContract;

public class MaPresenterImpl implements IMaContract.IMaPresenter {
    IMaContract.IMaView iMaView;
    private final IMaModel maModel;

    public MaPresenterImpl(IMaContract.IMaView iMaView) {
        this.iMaView = iMaView;
        iMaView.setPresenter(this);
        maModel = new MaModelImpl();
    }

    @Override
    public void loginMa(String header,String phone) {
        maModel.responseDataMa(header,phone,new IMaModel.SetOnDataChangedListener() {
            @Override
            public void setOnData(String message) {
                iMaView.showData(message);
            }
        });
    }

    @Override
    public void login(String header, String phone,String yanZhengMa) {
        maModel.responseLoginData(header, phone, yanZhengMa, new IMaModel.SetOnDataChangedListener1() {
            @Override
            public void setOnData1(LoginBean loginBean) {
                iMaView.showLoginData(loginBean);
            }
        });
    }
}
